//Linker tool for the cores


TOOL.Category = "GCOMBAT09"
TOOL.Name = "Damage Control"
TOOL.Command = nil
TOOL.ConfigName = "" --Setting this means that you do not have to create external configuration files to define the layout of the tool config-hud 

TOOL.ents = {}

function TOOL:LeftClick( tr )
	if (!tr.Entity) then return false end
	if (!tr.Entity:IsValid() ) then return false end
	if (tr.Entity:IsPlayer()) then return false end
	if (tr.Entity:IsWorld()) then return false end
 	if ( CLIENT ) then return true end
	if (tr.Entity.Selected) then return false end
	if SERVER then
		ents[selected] = tr.Entity
		tr.Entity:SetColor(0,0,255)
		tr.Entity.Selected = true
	end
end

function TOOL:RightClick( tr )
	if (!tr.Entity) then return false end
	if (!tr.Entity:IsValid() ) then return false end
	if (tr.Entity:IsPlayer()) then return false end
	if (tr.Entity:IsWorld()) then return false end
	if (!tr.Entity:GetClass() == "DCU") then return false end
 	if ( CLIENT ) then return true end
	if SERVER then
		tr.Entity.RunLink(ents)
		for k,v in pairs(ents) do
			v:SetColor(255,255,255)
		end
	end
end

function TOOL:Reload( tr )
	if SERVER then
		if !tr then return end
		local DCU = ents:Create("DCU")
		DCU:SetPos(tr.HitPos)
		local phys = DCU:GetPhysicsObject()
			phys:Wake()
			phys:Freeze()
		end
	end
end